/* 
 * File:   main.cpp
 * Author: maxds
 *
 * Created on 4 novembre 2011, 17:14
 */

#include <cstdlib>
#include <iostream>

#include "Actor.h"
#include "Closures.h"
#include "ThreadPool.h"


using namespace std;

/**
 * Une fonction
 * @param arg
 * @return
 */
class UneFonction: public virtual Functional::Routine<int,int>{
public:
     int invok(int &arg){
        std::cout << "Dans UneFonction"<< std::endl;
        return 0;
    }
};


/**
 * Une fonction
 * @param arg
 * @return
 */
class UneAutreFonction: public virtual Functional::Routine<string,int>{
public:
     int invok(string &arg){
        for(int i=0;i<10;i++){
            std::cout << "Dans UneAutreFonction"<< std::endl;
        }
        return arg.length();
    }
};

int main(int argc, char** argv) {

    
    int ref=11;
    string arg = "ameziane";
    
    UneFonction f;
    Functional::Function<int,int> func_g(&f);
    func_g(ref);
    
    UneAutreFonction h ;
    Functional::Function<string,int> func_h(&h);
    cout<<"val:"<<func_h(arg)<<endl;

    Threading::Thread* t=Threading::create_thread(Threading::thread_work,NULL);
    Threading::Thread* u=Threading::create_thread(Threading::thread_work,NULL);


    Threading::join_thread(t);
    Threading::join_thread(u);

    delete t;
    delete u;
    
    return 0;
}

